package com.xizi.lotterySystem.service.enumerate;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum ActivityPrizeTiersEnum {
    FIRST_PRIZE(1,"一等奖"),
    SECOND_PRIZE(2,"二等奖"),
    THIRD_PRIZE(3,"三等奖");

    private int code;
    private String tiers;

    public static ActivityPrizeTiersEnum forTiers(String tiers) {
        for (ActivityPrizeTiersEnum item : ActivityPrizeTiersEnum.values()) {
            if (item.name().equals(tiers)) {
                return item;
            }
            if(item.getTiers().equals(tiers)) {
                return item;
            }
        }
        throw new IllegalArgumentException("Invalid tiers: " + tiers);
    }
}
